<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>过渡-动画</title>
    
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
    /*显示隐藏的过滤效果*/
        .xxx-enter-active,.xxx-xxx-leave-active{
            transition: opacity 1s;
        }
        /*显示隐藏效果*/
        .xxx-enter,.xxx-leave-to{
            opacity: 0;
        }
        /*显示隐藏的过滤效果*/
        .move-enter-active{
            transition: all 1s;
        }
        /*隐藏的过滤效果*/
        .move-leave-active{
            transition: all 3s;
        }
        /*隐藏时的样式*/
        .move-enter,.move-leave-to{
            opacity: 0;
            transform: translateX(20px);
        }
    </style>

</head>
<body>
    <div id="app">
    <!--
        1.vue动画的理解
        操作css的transition或animation
        vue会给目标元素添加或移除特定的class
        2.基本过渡动画的编码
        1>.在咪表元素外包装<transition name = "xxx">
        2>.定义class样式
            1>.指定过渡样式：transition
            2>.指定隐藏时的样式：opacity/其他
        3.过渡的类名
            xxx-enter-active:指定显示的transition
            xxx-leave-active:指定隐藏的transition
            xxx-enter：指定隐藏时的样式
    -->
</div>
<script>
    let demo ={
        template:`
        <div>
            <div>
                <button @click="isShow =!isShow">toggle</button>
                <transition name="xxxx">
                <p v-show="isShow" class="xxx-enter-to">hello</p>
                </transition>
            </div>
        </div>
    `,
    data(){
        return{
            isShow:true
        }
    }
} 
    let App={
        template:`
        <div>
            <div>
                <button @click="isShow =!isShow">toggle</button>
                <transition name="xxxx">
                <p v-show="isShow" class="xxx-enter-to">hello</p>
                </transition>
            </div>
            
        </div>
    `,
    data(){
        return{
            isShow:true
    }
    },
    components:{ demo }
}
    new Vue({
        render: h => h(App)
    }).$mount("#app")
</script>
</body>
</html>